Skip to content

Conversation

glughi
Copy link
Contributor

@glughi glughi commented Jun 20, 2024

What this PR does

This PR adds the trait ClusteringTraits to GeoJsonTraits. In this way, it becomes possible to enable the clustering of entities made available by Cesium. Clusterized entities are represented as billboards generated by the fromText function of PinBuilder and report the number of grouped entities. As a result, clustering only works by using Cesium as a viewer, but there are no drawbacks to switching from Cesium to Leaflet at runtime.

Test me

Add a GeoJson or WFS layer of points to the catalog and use new parameters
In example:

"clustering": {
  "enabled": true
},

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@ljowen ljowen requested a review from tephenavies August 13, 2024 04:29
const dataSource = await this.loadGeoJsonDataSource(geoJsonWgs84);

if (this.clustering.enabled) {
const pinBackgroundColor = this.clustering.pinBackgroundColor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know anything about runInAction(...), but a lot of the surrounding code uses that for accessing things in this. Does this code not need that for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pjonsson,
runInAction, like action, is required when you modify an observable.
This code acts before the modification and the modification is already in a runInAction (at line 635).
So, this code not need runInAction.

@glughi
Copy link
Contributor Author

glughi commented Oct 14, 2025

Hello, any news?

@niktayv
Copy link
Collaborator

niktayv commented Oct 15, 2025

@glughi Hi, Giovanni. Thank you for your efforts and submission! The code looks good to me, but I could not observe any clustering on my local copy after adding your suggested parameters to the "GeoJSON Test" item from the default simple.json in TerriaMap. Here is what I did:

        {
          "id": "DL4Av6wY5h",
          "type": "geojson",
          "name": "GeoJSON Test",
          "url": "test/bike_racks.geojson",
          "clustering": {
            "enabled": true
          }
        },

What did I miss?

@glughi
Copy link
Contributor Author

glughi commented Oct 15, 2025

Hello @niktayv, you're right. This clustering is currently only activated if you definestyle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants